package com.ygsoft.activiti.service;


import com.ygsoft.activiti.model.MyModel;
import com.ygsoft.activiti.model.MyProcess;
import com.ygsoft.activiti.model.TaskModel;

import java.awt.image.BufferedImage;
import java.io.UnsupportedEncodingException;
import java.util.List;

/**
 * 操作activiti流程生成相关资源的接口
 *     //关于流程的操作API
     DeploymentBuilder createDeployment();
     void deleteDeployment(String deploymentId);
     void deleteDeploymentCascade(String deploymentId);
     void deleteDeployment(String deploymentId, boolean cascade);
     List<String> getDeploymentResourceNames(String deploymentId);
     InputStream getResourceAsStream(String deploymentId, String resourceName);
     ProcessDefinitionQuery createProcessDefinitionQuery();
     NativeProcessDefinitionQuery createNativeProcessDefinitionQuery();
     DeploymentQuery createDeploymentQuery();
     NativeDeploymentQuery createNativeDeploymentQuery();

     //激活终止流程的API操作
     void suspendProcessDefinitionById(String processDefinitionId);
     void suspendProcessDefinitionById(String processDefinitionId, boolean suspendProcessInstances, Date suspensionDate);
     void suspendProcessDefinitionByKey(String processDefinitionKey);
     void suspendProcessDefinitionByKey(String processDefinitionKey, boolean suspendProcessInstances, Date suspensionDate);
     void activateProcessDefinitionById(String processDefinitionId);
     void activateProcessDefinitionById(String processDefinitionId, boolean activateProcessInstances, Date activationDate);
     void activateProcessDefinitionByKey(String processDefinitionKey);
     void activateProcessDefinitionByKey(String processDefinitionKey, boolean activateProcessInstances,  Date activationDate);
     void setProcessDefinitionCategory(String processDefinitionId, String category);

     //查询流程资源的操作
     InputStream getProcessModel(String processDefinitionId);
     InputStream getProcessDiagram(String processDefinitionId);
     ProcessDefinition getProcessDefinition(String processDefinitionId);
     BpmnModel getBpmnModel(String processDefinitionId);
     DiagramLayout getProcessDiagramLayout(String processDefinitionId);

     //流程定义权限的操作
     void addCandidateStarterUser(String processDefinitionId, String userId);
     void addCandidateStarterGroup(String processDefinitionId, String groupId);
     void deleteCandidateStarterUser(String processDefinitionId, String userId);
     void deleteCandidateStarterGroup(String processDefinitionId, String groupId);
 * @author zhx
 * @create 2017-11-13 13:53
 **/
public interface RespositoryServiceInf {

    /**
     * 新建model接口
     * @param name
     * @param key
     * @param description
     * @return
     * @throws UnsupportedEncodingException
     */
    String createModel(String name, String key, String description) throws UnsupportedEncodingException;

    /**
     * 部署model
     * @param modelId
     * @return
     */
    boolean deployModel(String modelId);

    /**
     * 删除model
     * @param modelId
     * @return
     */
    boolean deleteModel(String modelId);

    /**
     * 获取流程图
     * @param processId
     * @return
     */
    String getProcessXML(String processId);

    /**
     * 获取流程定义的图片
     * @param processId
     * @return
     */
    BufferedImage getProcessImg(String processId);

    /**
     * 获取流程走到哪里的方法
     * @param processInstanceId
     * @return
     */
    String getProgressImg(String processInstanceId);

    /**
     * 获取全部流程定义 主
     * @return
     */
    List<MyModel> getAllModule();

    /**
     * 获取全部已经部署的流程列表
     * @return
     */
    List<MyProcess> getAllProcess();

    /**
     * 删除部署的流程ID
     * @param deployId
     * @return
     */
    boolean deleteDeployment(String deployId);

    /**
     * 更改流程状态
     * -1：错误 1：激活 2：挂起
     */
    int changeProcessStatus(String processId);



    /************************************流程流转中的控制**************************************************/

    /**
     * 驳回到某节点
     */



    /**
     * 删除
     */
    boolean delProcessId(String processId);


    /**
     * 获取这个流程的所有任务
     */
    List<TaskModel> getAllTaskModel(String processId);
}
